package com.qf.business.coupon.controller;

import com.qf.business.coupon.service.CoupomTemplateService;
import com.qf.entity.base.R;
import com.qf.entity.po.CouponTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/coupon/template")
public class CouponTemplateController {

    @Autowired
    private CoupomTemplateService coupomTemplateService;

    /**
     * 新增优惠券模板
     * @return
     */
    @PostMapping("/insert")
    public R insert(@RequestBody CouponTemplate couponTemplate){
        System.out.println("新增优惠券模板:" + couponTemplate);
        coupomTemplateService.save(couponTemplate);
        return R.succ();
    }

    /**
     * 查询优惠券模板列表
     * @return
     */
    @GetMapping("/list")
    public R list(){
        return R.succ(coupomTemplateService.list());
    }
}
